﻿using System.Collections.Generic;
using ShopB2C.Entity;

namespace ShopB2C.Interfaces
{
    /// <summary>
    /// 商品类操作主接口
    /// </summary>
    public interface IProductOperate
    {

        #region 商品基础信息

        /// <summary>
        /// 获取商品基础资料
        /// </summary>
        /// <param name="para">商品ID</param>
        /// <returns>ProductEntity</returns>
        ProductEntity GetBasicById(int productId);
        /// <summary>
        /// 保存商品基础信息
        /// </summary>
        /// <param name="para"></param>
        /// <returns>受影响的行数,0则表示没有行首影响</returns>
        int SaveProductBasic(ProductEntity para);
        /// <summary>
        /// 更改商品分类
        /// </summary>
        /// <param name="productId">关联的商品ID</param>
        /// <param name="classId">更改的分类ID</param>
        int ChangeClass(int productId , int classId);
        /// <summary>
        /// 删除商品:执行此操作将联合商品详细信息,商品图片扩展同步删除,请谨慎操作
        /// </summary>
        /// <returns>返回受影响的行数</returns>
        int DeleteProduct(int productIds);
        /// <summary>
        /// 会员折扣
        /// </summary>
        /// <param name="userLevelEntity">关联的会员组信息</param>
        /// <returns>受影响的行</returns>
        int SaveMemberDiscount(UserLevelEntity userLevelEntity);
        #endregion

        #region 属性
        /// <summary>
        /// 保存属性
        /// </summary>
        /// <param name="propertyList">属性列表</param>
        /// <returns>受影响的行</returns>
        int SaveProperty(List<ProductPropertyEntity> propertyList);

        #endregion


        #region 商品图片

        /// <summary>
        /// 保存图片扩展
        /// </summary>
        /// <param name="para"></param>
        /// <returns>返回受影响的行</returns>
        int SaveImage(ProductImageEntity para);
        /// <summary>
        /// 设置封面
        /// </summary>
        /// <param name="productId">关联的商品ID</param>
        /// <returns>受影响的行</returns>
        int SetCover(int imageId);
        /// <summary>
        /// 删除图片扩展
        /// </summary>
        /// <returns>返回受影响的行</returns>
        List<ProductImageEntity> DeleteImage(string[] para);

        #endregion

        #region 商品详细信息
        /// <summary>
        /// 保存商品详细信息
        /// </summary>
        /// <returns>返回受影响的行</returns>
        int SaveDetails(ProductDetailsEntity para);

        #endregion

        #region 批量操作

        /// <summary>
        /// 更新库存数
        /// </summary>
        /// <param name="productId">商品ID</param>
        /// <param name="stockCount">库存数</param>
        /// <returns>受影响的行</returns>
        int UpdateStock(int productId , int stockCount);
        /// <summary>
        /// 更改激活状态
        /// </summary>
        /// <param name="productId">商品ID</param>
        /// <param name="IsActive">激活状态</param>
        /// <returns>被更改的行数</returns>
        int ChangeActive(int productId , bool IsActive);
        /// <summary>
        /// 更新实际上架时间
        /// </summary>
        /// <param name="ProductId">商品ID</param>
        /// <param name="saleDateTime">实际上架时间</param>
        /// <returns>受影响的行</returns>
        int UpdateSalesDateTime(int productId , System.DateTime saleDateTime);
        /// <summary>
        /// 打折
        /// </summary>
        /// <param name="productId">商品ID</param>
        /// <param name="discount">折扣率</param>
        /// <returns>受影响的行数</returns>
        int Discount(int productId , double discount);
        #endregion

        #region 高级属性

        /// <summary>
        /// 保存高级属性
        /// </summary>
        /// <param name="productExtendEntity"></param>
        /// <returns></returns>
        int SaveExtend(ProductExtendEntity productExtendEntity);
        /// <summary>
        /// 删除高级属性
        /// </summary>
        /// <param name="extendId"></param>
        /// <returns></returns>
        int DeleteExtendItem(int extendId);

        #endregion

        /// <summary>
        /// 保存首页部件
        /// </summary>
        /// <param name="title">标题</param>
        /// <param name="IsValid">是否启用</param>
        /// <param name="partType">部件类型</param>
        /// <param name="count">显示数量</param>
        /// <param name="ids">高级模式时显示的产品ID</param>
        /// <returns></returns>
        int ProductPartSave(int partId , string title , bool isValid , int partType , int count , int classId , int sequence , string ids,string modekKey);
        /// <summary>
        /// 删除部件
        /// </summary>
        /// <param name="partId">部件ID</param>
        /// <returns>被影响的行</returns>
        int ProductPartDelete(int partId);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="iv"></param>
        /// <param name="se"></param>
        /// <returns></returns>
        int ProductPartUpdate(string id , string iv , string se);
        /// <summary>
        /// 保存相关产品
        /// </summary>
        /// <param name="relateIds">关联商品列表</param>
        /// <param name="PrimaryKey">关联的产品主键</param>
        /// <returns>被影响的行数</returns>
        int SaveRelate(string relateIds , int PrimaryKey,string title);
        /// <summary>
        /// 更新图片描述
        /// </summary>
        /// <param name="imageId">关联的图片ID</param>
        /// <param name="title">图片标题</param>
        /// <param name="description">图片描述</param>
        /// <param name="sequence">排序ID</param>
        /// <returns>受影响的行</returns>
        int UpdateImageDescription(int imageId , string title , string description , int sequence);
    }
}
